/*************************************************************************
	> File Name: Example5_3.java
	> Author: Potter
	> Mail: tobewhatwewant@gmail.com 
	> Created Time: 2014年07月07日 星期一 21时28分28秒
 ************************************************************************/

public class Example5_3 {
    public static void main(String args[]) {
        CheapGoods cheapGoods = new CheapGoods();
        // cheapGoods.weight = 198.98; // 是非法的，因为子类对象的weight变量已经是int型
        cheapGoods.newSetWeight(198);
        System.out.println("对象 cheapGoods 的 weight 的值是：" + cheapGoods.weight);
        System.out.println("cheapGoods 用子类新增的优惠价格计算方法计算价格: " + cheapGoods.newGetPrice());

        cheapGoods.oldSetWeight(198.987); // 子类对象调用继承的方法操作隐藏的double型
                                        // 变量weight
        System.out.println("cheapGoods 使用继承方法(无优惠)计算价格是" + cheapGoods.oldGetPrice());
    }
}
